package com.java.socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class TcpClientB {

	public static void main(String[] args) {
		Socket s=null;
		BufferedReader br=null;
		PrintWriter pw=null;
		try {
			s=new Socket("127.0.0.1",8888);
			pw=new PrintWriter(new OutputStreamWriter((s.getOutputStream())));
			pw.write("helloheheheiheispringreadwriter");
			pw.flush();       
			br=new BufferedReader(new InputStreamReader(s.getInputStream()));
			String str=br.readLine();
			System.out.println(str);
			
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
